import { allIdentityApi, allDepartmentApi } from "./api";
import { Icon } from "antd";
//const basicUrl = "http://localhost:9527/huan/";
const basicUrl = "http://47.111.158.147:9527/huan/";
const userUrl = basicUrl + "user/";
//const userUrl = "http://47.120.32.73:8001/";
const patrolUrl = basicUrl + "patrol/";
const inspectUrl = basicUrl + "inspect/";
const backstageUrl = basicUrl + "backstage/";
const zhizhouUrl = basicUrl + "zhizhou/";
const kaoqinUrl = basicUrl + "kaoqin/";
const pushUrl = basicUrl + "push/";
//const questionnaireUrl = basicUrl + "questionnaire/";
const questionnaireUrl = "http://47.120.32.73:8008/";
//const baseUrl = 'http://47.111.158.147:8080/SchoolSecurityService1';
// const baseUrl = 'https://tidukeji.cn/wechatpushTest';
//  const baseUrl = 'http://localhost:8083/SchoolSecurityService/';
// const baseUrl = 'http://localhost:8002/';
// const baseUrl = 'http://192.168.50.128/manager/';
// const baseUrl = 'http://localhost:8002/';
const baseUrlSurvey = 'http://localhost:9080/survey/';
// const baseUrl = 'http://120.78.164.199:8080/SchoolSecurityService/';
// const baseUrl = 'https://tidukeji.cn/SchoolSecurityService1/';
// const baseUrl = 'http://39.98.73.72:8080/SchoolSecurityService/'; //线上

const baseUrl ='http://localhost:8080/SchoolSecurityService/';
// const baseUrl= "https://tidukeji.cn/SchoolSecurityService1/";
//    const preUrl = "http://localhost:8081/BigScreenService/";
const preUrl = "https://tidukeji.cn/bigScreenService/";
//    const baseUrl = 'http://localhost:8080/SchoolSecurityService/';
//    const baseUrl = 'http://localhost:8002/';
const dailyUrl = 'http://localhost:7071/';
const formUrl = 'http://localhost:7071/';

//const  preUrl="http://localhost:8081/BigScreenService/" ;

const memberUploadTemplateUrl = "https://tidukeji.cn/download/memberlist.xlsx";
const inspectitemUploadTemplateUrl = "https://tidukeji.cn/download/inspectitem.xlsx";
const zhizhouitemUploadTemplateUrl = "https://tidukeji.cn/download/zhizhouitem.xlsx";
const zhizhourelationUploadTemplateUrl = "https://tidukeji.cn/download/zhizhourelation.xlsx";
const zhizhouClassNameUploadTemplateUrl = "https://tidukeji.cn/download/zhizhouclass.xlsx";
const userUploadTemplateUrl = "https://tidukeji.cn/download/user.xlsx";

const gridStudentUrl = "https://tidukeji.cn/download/gridStudent.xlsx";
const gridFiveOldStaffUrl = "https://tidukeji.cn/download/gridFiveOldStaff.xlsx";
const gridOutAdminUrl = "https://tidukeji.cn/download/gridOutAdmin.xlsx";
const gridInAdminUrl = "https://tidukeji.cn/download/gridmember.xlsx";

const addressUploadTemplateUrl = "https://tidukeji.cn/download/address.xlsx";
const userInfoUploadTemplateUrl = "https://tidukeji.cn/download/userinfo.xlsx";
const relationUploadTemplateUrl = "https://tidukeji.cn/download/relation.xlsx"

const classMemberUploadTemplateUrl = "https://tidukeji.cn/download/xunjianbanzu.xlsx";
const wangGeGuiHuaUploadTemplateUrl = "https://tidukeji.cn/download/wanggeguihua.xlsx";
const inspectPlanUploadTemplateUrl = "https://tidukeji.cn/download/xunjianjihua.xlsx";

// const UrlPrefix = 'http://localhost:3000';
// 图片路径
const UrlPrefix = 'https://tidu-hangzhou.oss-cn-hangzhou.aliyuncs.com';
// 大屏路径
const screenUrl = 'http://47.111.158.147:3000';
//const screenUrl = 'http://localhost:3000';
// const UrlPrefix = 'https://tidukeji.cn';

//const UrlPrefix = 'https://examplebuket-hanghzou1.oss-cn-hangzhou.aliyuncs.com';
// const UrlPrefix = 'http://localhost:3000';
const iconFontUrl = '//at.alicdn.com/t/font_855044_3bt0v0uebfk.js';
let allIdentityForEdu;
let allIdentityForSchool;
export const getAllIdentity = (userType, departmentId) => {
    if (userType == '教育局用户') {
        if (allIdentityForEdu == undefined) {
            allIdentityForEdu = allIdentityApi(userType, departmentId);
        }
        return allIdentityForEdu;
    } else if (userType == "学校用户") {
        if (allIdentityForSchool == undefined) {
            allIdentityForSchool = allIdentityApi(userType, departmentId);
        }
        return allIdentityForSchool;
    }
}

let allDepartmentForEdu = undefined;
let allDepartmentForSchool = undefined;
export let getAllDepartment = (userType) => {
    if (userType == "教育局用户") {
        if (allDepartmentForEdu == undefined) {
            allDepartmentForEdu = allDepartmentApi(userType);
        }
        return allDepartmentForEdu;
    } else if (userType == "学校用户") {
        if (allDepartmentForSchool == undefined) {
            allDepartmentForSchool = allDepartmentApi(userType);
        }
        return allDepartmentForSchool;
    }
}

export let afterDepartmentDataChange = (type) => {
    if (type == "school") {
        allDepartmentForSchool = undefined;
    } else if (type == "edudepartment") {
        allDepartmentForEdu = undefined;
    }
}


export { baseUrl, preUrl, UrlPrefix, iconFontUrl, baseUrlSurvey, memberUploadTemplateUrl, 
    inspectitemUploadTemplateUrl, zhizhouitemUploadTemplateUrl, userUploadTemplateUrl, 
    zhizhouClassNameUploadTemplateUrl, gridStudentUrl, gridFiveOldStaffUrl, gridOutAdminUrl, 
    gridInAdminUrl, addressUploadTemplateUrl, userInfoUploadTemplateUrl, relationUploadTemplateUrl, classMemberUploadTemplateUrl, wangGeGuiHuaUploadTemplateUrl, inspectPlanUploadTemplateUrl, dailyUrl, 
    zhizhourelationUploadTemplateUrl, screenUrl, formUrl, userUrl, patrolUrl, inspectUrl, backstageUrl, zhizhouUrl, kaoqinUrl, pushUrl, questionnaireUrl
};
